package cn.hennancf.picture.entities;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/** 
* @author  作者: 陈飞
* @date 创建时间：2017年3月11日 下午5:37:24 
* @version 1.0 
* @param  files 文件夹里的所有非文件夹的文件
* @param  folders 文件夹的子文件夹
* @param  url 文件夹的路径
* @param  name 文件夹的名字
* @since  
* @return  
*/
public class Folder {

    private List<File> files = new ArrayList<File>();
    private List<Folder> folders = new ArrayList<Folder>();
    private File url;
    private String name;
    
    
    public Folder() {
        super();
    }
    
    public Folder(File url, String name) {
            super();
            this.url = url;
            this.name = name;
        }
    
    
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((files == null) ? 0 : files.hashCode());
        result = prime * result + ((folders == null) ? 0 : folders.hashCode());
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        result = prime * result + ((url == null) ? 0 : url.hashCode());
        return result;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Folder other = (Folder) obj;
        if (files == null) {
            if (other.files != null)
                return false;
        } else if (!files.equals(other.files))
            return false;
        if (folders == null) {
            if (other.folders != null)
                return false;
        } else if (!folders.equals(other.folders))
            return false;
        if (name == null) {
            if (other.name != null)
                return false;
        } else if (!name.equals(other.name))
            return false;
        if (url == null) {
            if (other.url != null)
                return false;
        } else if (!url.equals(other.url))
            return false;
        return true;
    }

    @Override
    public String toString() {
        return "Folder [files=" + files + ", folders=" + folders + ", url=" + url + ", name=" + name + "]";
    }

    //    get和set方法
    public List<File> getFiles() {
        return files;
    }
    public void setFiles(List<File> files) {
        this.files = files;
    }
    public List<Folder> getFolders() {
        return folders;
    }
    public void setFolders(List<Folder> folders) {
        this.folders = folders;
    }
    public File getUrl() {
        return url;
    }
    public void setUrl(File url) {
        this.url = url;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    
}
